<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class Store extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'id' => $this->id,
            'name' => $this->name,
            'logo' => getUploadPath($this->logo),
            'logo_path' => $this->logo,
            'legal_person' => $this->legal_person,
            'license' => getUploadPath($this->license),
            'license_path' => $this->license,
            'status_text' => \App\Models\Store::STATUS_MAP[$this->status],
            'status' => $this->status,
            'opt_reason' => $this->opt_reason,
            'store_pass' => $this->store_pass,
            'created_at' => $this->created_at->toDateTimeString(),
            'updated_at' => $this->updated_at->toDateTimeString(),
        ];
    }
}
